<template>
  <div>
    <!-- <h3>图片列表</h3> -->
    <!-- 顶部滑动 -->
    <div id="slider" class="mui-slider">
      <div
        id="sliderSegmentedControl"
        class="mui-scroll-wrapper mui-slider-indicator mui-segmented-control mui-segmented-control-inverted"
      >
        <div class="mui-scroll">
          <a :class="['mui-control-item',i == 0?'mui-active':'']"
            href="#item2mobile"
            data-wid="tab-top-subpage-2.html"
            v-for="(item, i) in titles"
            :key="i"
          >{{ item.title }}</a>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
// 1. 导入 mui 的js文件
import mui from "../../lib/mui/js/mui.min.js";

export default {
  mounted() {
    // 2.初始化滑动控件
    mui(".mui-scroll-wrapper").scroll({
      deceleration: 0.0005 //flick 减速系数，系数越大，滚动速度越慢，滚动距离越小，默认值0.0006
    });
  },
  data() {
    return {
      titles: [
        {
          id: 1,
          title: "热点"
        },
        {
          id: 2,
          title: "北京"
        },
        {
          id: 3,
          title: "社会"
        },
        {
          id: 4,
          title: "娱乐"
        },
        {
          id: 5,
          title: "科技"
        },
        {
          id: 6,
          title: "新闻"
        },
        {
          id: 7,
          title: "军事"
        },
        {
          id: 8,
          title: "生活"
        }
      ]
    };
  },
  created() {
    this.getAll();
  },
  methods: {
    getAll() {
      this.titles.unshift({ id: 0, title: "全部" });
    }
  }
};
</script>
<style scoped>
* {
  touch-action: pan-y;
}
</style>